﻿@{
    <script src="~/js/jquery-1.11.1.js"></script>
    <link href="~/css/table.css" rel="stylesheet" />
    <script src="~/js/vue.js"></script>
}
<body>
    <div id="app">
        <table width="100%">
            <tr>
                <td>
                    <font color="black">
                        您正在做的业务是：人力资源--客户化设置--人力资源档案管理设置--职位分类设置
                    </font>
                </td>
            </tr>
            <tr>
                <td align="right">
                    <input type="button" value="添加" class="BUTTON_STYLE1"
                           onclick="window.location.href='/client1/major_kind_add';">
                </td>
            </tr>
        </table>
        <table width="100%" border="1" cellpadding=0 cellspacing=1
               bordercolorlight=#848284 bordercolordark=#eeeeee
               class="TABLE_STYLE1">
            <tr>
                <td width="46%" class="TD_STYLE1">
                    职位分类编号
                </td>
                <td width="47%" class="TD_STYLE1">
                    职位分类名称
                </td>
                <td width="5%" class="TD_STYLE1">
                    删除
                </td>
            </tr>
            <tr v-for="(item,index) in dt" :key="item.mfk_id">
                <td class="TD_STYLE2">
                    {{item.major_kind_id }}
                </td>
                <td class="TD_STYLE2">
                    {{item.major_kind_name }}
                </td>
                <td class="TD_STYLE2">
                    <a href="#" v-on:click="del([item.mfk_id])">删除</a>
                </td>
            </tr>
        </table>
        <p>
    </div>
</body>
<script type="text/javascript">
    var vm = new Vue({
        el: "#app",
        data: {
            dt: []
        },
        methods: {
            load: function () {
                var t = this;
                $.ajax({
                    url: "/client1/major_kinds",
                    type: "post",
                    success: function (msg) {
                        var d = eval(msg);
                        t.dt = d;
                    }
                });
            }, del: function (id) {
                if (confirm('确定要删除吗')) {
                    var t = this;
                    $.ajax({
                        url: "/client1/major_kindsDelete",
                        type: "DELETE",
                        data: "id=" + id,
                        success: function (msg) {
                            if (msg > 0) {
                                alert('删除成功');
                                t.load();
                            }
                        }
                    });
                }
            }
        }, mounted: function () {
            this.load();
        }
    });
</script>
